﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Messaging;
using System.ServiceProcess;
using System.Text;


namespace Common.Eventing.Msmq.Service
{
    public partial class MsmqService : ServiceBase
    {
        private const string _queuePath = "queuePath";
        private bool _shouldContinue;
        private MessageQueue _myQueue;


        public MsmqService()
        {
            InitializeComponent();

            string queuePath = ConfigurationManager.AppSettings[_queuePath];

            _myQueue = MessageQueue.Exists(queuePath)
                ? new MessageQueue(queuePath)
                : MessageQueue.Create(queuePath);
        }

        protected override void OnStart(string[] args)
        {
            _shouldContinue = true;
            
            while (this._shouldContinue)
            {

            }
        }

        protected override void OnStop()
        {
            _shouldContinue = false;
        }
    }
}
